package com.wang.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * 
 * @TableName parking_space
 */
@TableName(value ="parking_space")
@Data
public class ParkingSpace implements Serializable {
    /**
     * 车位id
     */
    @TableId(value = "parking_space_id", type = IdType.AUTO)
    private Integer parkingSpaceId;

    /**
     * 车位编号
     */
    @TableField(value = "space_number")
    private Integer spaceNumber;

    /**
     * 是否占用（0/1）
     */
    @TableField(value = "occupied")
    private Integer occupied;

    /**
     * 绑定车辆车牌号
     */
    @TableField(value = "car_number")
    private String carNumber;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ParkingSpace other = (ParkingSpace) that;
        return (this.getParkingSpaceId() == null ? other.getParkingSpaceId() == null : this.getParkingSpaceId().equals(other.getParkingSpaceId()))
            && (this.getSpaceNumber() == null ? other.getSpaceNumber() == null : this.getSpaceNumber().equals(other.getSpaceNumber()))
            && (this.getOccupied() == null ? other.getOccupied() == null : this.getOccupied().equals(other.getOccupied()))
            && (this.getCarNumber() == null ? other.getCarNumber() == null : this.getCarNumber().equals(other.getCarNumber()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getParkingSpaceId() == null) ? 0 : getParkingSpaceId().hashCode());
        result = prime * result + ((getSpaceNumber() == null) ? 0 : getSpaceNumber().hashCode());
        result = prime * result + ((getOccupied() == null) ? 0 : getOccupied().hashCode());
        result = prime * result + ((getCarNumber() == null) ? 0 : getCarNumber().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", parkingSpaceId=").append(parkingSpaceId);
        sb.append(", spaceNumber=").append(spaceNumber);
        sb.append(", occupied=").append(occupied);
        sb.append(", carNumber=").append(carNumber);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}